<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>山东营销风云榜</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../../css/part/tabHead.css">
    <link rel="stylesheet" href="../../../css/part/mini.css">
</head>
<style>

    th {
        font-size: 12px;
    }

</style>
<body>

<div id="app">
    <div id="tableHead">
        <img src="../../../img/part/performance/deptReach.png" id="saleDeptHead" align="center">
        <a href="../../portal/navigationYX.html"><img src="../../../img/portal/min.png" id="miniImg"></a>
        <table width="100%">
            <tr>
                <thead>
                <th width="6%">NO</th>
                <th width="16%">机构</th>
                <th width="16%">月承保增长</th>
                <th width="15%">季度承保</th>
                <th width="16%">季承保增长</th>
                <th width="15%">年度承保</th>
                <th width="16%">年承保增长</th>
                </thead>
            </tr>
        </table>
    </div>
    <div id="midDiv"></div>
    <div class="tableBody">
        <table id="tab" width="100%">
            <tbody id="tbody">
            </tbody>
        </table>
    </div>
</div>
</body>
<script src="../../../js/vue.js"></script>
<script src="../../../js/axios.js"></script>
<script src="../../../js/head.js"></script>
<script src="../../../js/jquery-3.2.1.min.js"></script>
<script src="../../../js/share.js"></script>

<script>
    window.onload = function () {
        new Vue({
            el: '#app',
            data() {
                return {

                    //营服名称
                    saleDeptsName: '',
                    //月承保增长
                    deptMonthIncrease: 0,
                    //季度承保
                    deptQuarterInSure: 0,
                    //季承保增长
                    deptQuarterIncrease: 0,
                    //年度承保
                    deptYearInSure: 0,
                    //年承保增长
                    deptYearIncrease: 0,

                    pojo: {},
                    divHeight: 0
                }
            },
            created() {
                this.getSaleDeptLayerAttend();
            },
            methods: {

                //获取各中支的数据
                getSaleDeptLayerAttend() {
                    document.getElementById("midDiv").style.height = window.getComputedStyle(document.getElementById("tableHead")).getPropertyValue("height");
                    setTimeout(() => {
                        axios.get(`/performance/getSaleDeptReach`).then(response => {
                            this.pojo = response.data;
                            var str = "";//定义用于拼接的字符串
                            for (var i = 0; i < this.pojo.length; i++) {
                                //拼接表格的行和列
                                str = "<tr><td width=\"6%\">" + (i + 1) + "</td><td width=\"16%\">" + this.pojo[i].saleDeptsName + "</td><td width=\"16%\">" + this.pojo[i].deptMonthIncrease + "</td><td width=\"15%\">" + this.pojo[i].deptQuarterInSure + "</td><td width=\"16%\">" + this.pojo[i].deptQuarterIncrease + "</td><td width=\"15%\">" + this.pojo[i].deptYearInSure + "</td><td width=\"16%\">" + this.pojo[i].deptYearIncrease + "</td></tr>";
                                //追加到table中
                                $("#tbody").append(str);
                            }
                        })
                    }, 200)
                },
                //数据处理
                dataHandle(_this) {
                    var data = _this + "";
                    if (data.indexOf(".") != -1) {
                        return data + '%'
                    }
                    if (data == -9999) {
                        return '-'
                    }
                    return data + ".0" + '%';
                },
                dataHandleD(_this) {
                    var data = _this + "";
                    if (data.indexOf(".") != -1) {
                        return data
                    }
                    return data + ".0";
                }
            }
        })
    }
</script>

</html>